load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")

go_library(
    name = "kvflowtokentracker",
    srcs = ["tracker.go"],
    importpath = "github.com/cockroachdb/cockroach/pkg/kv/kvserver/kvflowcontrol/kvflowtokentracker",
    visibility = ["//visibility:public"],
    deps = [
        "//pkg/kv/kvserver/kvflowcontrol",
        "//pkg/kv/kvserver/kvflowcontrol/kvflowcontrolpb",
        "//pkg/kv/kvserver/kvflowcontrol/kvflowinspectpb",
        "//pkg/util/admission/admissionpb",
        "//pkg/util/buildutil",
        "//pkg/util/log",
    ],
)

go_test(
    name = "kvflowtokentracker_test",
    srcs = ["tracker_test.go"],
    data = glob(["testdata/**"]),
    embed = [":kvflowtokentracker"],
    deps = [
        "//pkg/kv/kvserver/kvflowcontrol",
        "//pkg/kv/kvserver/kvflowcontrol/kvflowcontrolpb",
        "//pkg/testutils/datapathutils",
        "//pkg/util/admission/admissionpb",
        "//pkg/util/leaktest",
        "//pkg/util/log",
        "@com_github_cockroachdb_datadriven//:datadriven",
        "@com_github_dustin_go_humanize//:go-humanize",
        "@com_github_stretchr_testify//require",
    ],
)
